<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/08/16 0016
 * Time: 15:01:51
 */
namespace  app\admin\Controller;
use app\admin\model\Shop;
use app\admin\model\User;
use app\common\controller\Baseadmin;

class Datasta extends Baseadmin {
    /**
     * @return mixed
     * 商户统计列表
     */
    public function newregister(){
        $data= $this->settimes();
        $timelists=settime($data);
        $num=[];
        foreach ($timelists as $k=>$v){
            $wheres['create_time'] =['between',[strtotime($v.' '.'00:00:00'),strtotime($v.' '.'23:59:59')]];
            $Shopmode=new Shop();
            $num[$k]=$Shopmode->where($wheres)->count();
        }
        $this->assign('num',json_encode($num,true));
        $this->assign('end',date('Y-m-d',$data['end']));
        $this->assign('begin',date('Y-m-d',$data['begin']));
        $this->assign('time',json_encode($timelists,true));
        return $this->fetch();
    }

    /**
     * @return mixed
     * 用户统计列表
     */
    public function UserSta(){
        $data= $this->settimes();
        $timelists=settime($data);
        $num=[];
        foreach ($timelists as $k=>$v){
            $wheres['addtime'] =['between',[strtotime($v.' '.'00:00:00'),strtotime($v.' '.'23:59:59')]];
            $Shopmode=new User();
            $num[$k]=$Shopmode->where($wheres)->count();
        }
        $this->assign('num',json_encode($num,true));
        $this->assign('end',date('Y-m-d',$data['end']));
        $this->assign('begin',date('Y-m-d',$data['begin']));
        $this->assign('time',json_encode($timelists,true));
        return $this->fetch();
    }

}